package com.example.coordinartordemo.demo5;

import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import com.example.coordinartordemo.R;
import com.google.android.material.bottomsheet.BottomSheetDialog;

public class Demo5Activity extends AppCompatActivity {
    private Button mBtn;
    private BottomSheetDialog mBottomSheetDialog;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_demo5);
        mBtn = findViewById(R.id.btn);

        initDialog();

        mBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mBottomSheetDialog.show();
            }
        });
    }

    private void initDialog() {
        mBottomSheetDialog = new BottomSheetDialog(this);
        View rootView = LayoutInflater.from(this).inflate(R.layout.dialog_bottom_sheet_share,null);
        mBottomSheetDialog.setContentView(rootView);
        mBottomSheetDialog.setCancelable(true);
        mBottomSheetDialog.setCanceledOnTouchOutside(true);
    }
}
